package com.dc.server.util;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.UUID;

/**
 * @Auther: 赵聪
 * @Date: 2018/8/4 21:00
 * @Description:
 */
public class OrderNoUtil {
    private static final String COMMON_DATE = "yyyyMMdd";

    public OrderNoUtil() {
    }

    public static String getSerialNumber() {
        int hashCode = UUID.randomUUID().toString().hashCode();
        if (hashCode < 0) {
            hashCode = -hashCode;
        }

        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
        return sdf.format(new Date()).substring(2, 8) + String.format("%010d", hashCode);
    }
}
